﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using GiaoTrinhEPU.Repositories;

namespace GiaoTrinhEPU.Repositories.DataModels
{
    public class WarehouseModel
    {
        [HiddenInput(DisplayValue = false)]
        public int Id { get; set; }

        [Required(ErrorMessage = "Tên kho không được để trống")]
        [DataType(DataType.Text)]
        [Display(Name = "Tên Kho")]
        [Remote("IsNameAvaiable", "Warehouse", AdditionalFields = "Id")]
        public String Name { get; set; }

        [Display(Name = "Mô Tả")]
        [DataType(DataType.MultilineText)]     
        [AllowHtml]
        public String Description { get; set; }

        public WarehouseModel () : base() { }
        public WarehouseModel(Warehouse warehouse)
            : base()
        {
            this.Id = (int)warehouse.Id;
            this.Name = warehouse.Name;
            this.Description = warehouse.Description;
            
        }
    }
}
